package leetcodecompetition.S117;

/**
 * @Author: Siantar
 * @Date: 2023-11-11-22:56
 * @Description: 1.0
 */
public class T100126 {
    public int stringCount(int n) {
        if (n < 4) return 0;
        long M = 10_0000_0007;
        long r = 23 * 23 * 23+23L * 23 * n * 3+23L * n * (n - 1) * 3+(long) n * (n - 1) * (n - 2)+ 23L *(n-1),s=26*26*26;
        for (int i = 3; i < n; i++) {
            r = r * 23 % M;
            s = s * 26 % M;
        }
        return (int) ((s - r + M) % M);
    }
}
